<template>
  <view class="container">
	  <!-- <view class="title">
			<text :class="typeIndex==index ? 'activeTitle':''"  v-for="(item,index) in typeArr" :key="index" @click="changeTypeIndex(index)">
				{{item.text}}
			</text>
	  </view> -->
	  <view class="arr">
			<view class="item" v-for="(item,index) in arr" :key="index" @click="handleTargetDetail(item.order_id)">
				<view class="top-Content">
					<text>{{item.new_grade_id}}</text>
					<text>{{item.create_time}}</text>
				</view>
				<view class="bot-Content">
					<view class="content" v-html="item.content">
					</view>
					<view class="type">
						{{item.lei_status}}
					</view>
				</view>
			</view>
	  </view>
  </view>
</template>

<script>
  import { setCartTabBadge } from '@/utils/app'
  import * as Api from '@/api/page'
  import Page from '@/components/page'

  const App = getApp()

  export default {
    components: {
      Page,
	 },
    data() {
      return {
        // 页面参数
        options: {},
        // 页面属性
        page: {},
        // 页面元素
        items: [],
		typeIndex: 0 ,
		// typeArr:[
		// 	  {
		// 		id:'',
		// 		text:'未完成',
		// 	  },
		// 	  {
		// 	  	id:'',
		// 	  	text:'已完成',
		// 	  },
		// ],
		arr:[
			  {
				name:'品王合伙人',
				time:'2021-11-16',
				content:'获取20箱红酒，获取20箱红酒，获取20箱红酒，获取20箱红酒，获取20箱红酒，获取20箱红酒，',
				type:'包邮',
			  },
			  {
			  	name:'品王合伙人',
			  	time:'2021-11-16',
			  	content:'获取20箱红酒，获取20箱红酒，获取20箱红酒，获取20箱红酒，获取20箱红酒，获取20箱红酒，',
			  	type:'自提',
			  },
		]
		
      }
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
      // 当前页面参数
      // this.options = options
      // 加载页面数据
      // this.getPageData();
	  this.getArr()
	  uni.setNavigationBarColor({
	  	frontColor: '#ffffff' ,
	  	backgroundColor: '#000000'
	  })
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
      // 更新购物车角标
      // setCartTabBadge()
    },

    methods: {
		// 跳转到订单详情页
		handleTargetDetail(orderId) {
			if(!orderId ){
				return
			}
		  this.$navTo('pages/order/detail', { orderId })
		},
		getArr(){
			this.myhttp({
				url:'?s=/api/User/gradeListLog'
			}).then(res=>{
				if(res.data.message=='success'){
					this.arr = res.data.data.list
				}
			})
		},
		changeTypeIndex(_index){
			this.typeIndex = _index
		},

    },

    /**
     * 下拉刷新
     */
    onPullDownRefresh() {
      // 获取首页数据
      this.getPageData(() => {
        uni.stopPullDownRefresh()
      })
    },

    /**
     * 分享当前页面
     */
    onShareAppMessage() {
      const app = this
      const { page } = app
      return {
        title: page.params.share_title,
        path: "/pages/index/index?" + app.$getShareUrlParams()
      }
    },

    /**
     * 分享到朋友圈
     * 本接口为 Beta 版本，暂只在 Android 平台支持，详见分享到朋友圈 (Beta)
     * https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
     */
    onShareTimeline() {
      const app = this
      const { page } = app
      return {
        title: page.params.share_title,
        path: "/pages/index/index?" + app.$getShareUrlParams()
      }
    }

  }
</script>

<style lang="scss" scoped>
  .container {
    background: #ebeef5;
	height: 100vh;
	.title{
		background: #fff;
		height: 85rpx;
		display: flex;
		text{
			flex: 1;
			display: grid;
			place-items: center;
			font-size: 32rpx;
			color: #b8b8b8;
		}
		.activeTitle{
			position: relative;
			color: #333332;
			&::after{
				content: '';
				position: absolute;
				bottom: 3%;
				width: 120rpx;
				height: 10rpx;
				border-radius: 8rpx;
				background: pink;
				background-image: linear-gradient( to right, #fff, #333);
			}
		}
	}
	.arr{
		margin: 20rpx;
		.item{
			background-color: #fff;
			margin-bottom: 20rpx;
			border-radius: 10rpx;
			box-shadow: 1px 1px 3px rgba(0,0,0,.1),inset 0 1px 3px rgba(0,0,0,.1);
			.top-Content{
				width: 100%;
				display: flex;
				justify-content: space-between;
				padding:  20rpx;
				border-bottom: 2rpx solid #b8b8b8;
				text{
					&:nth-child(2){
						color: #b8b8b8;
					}
				}
			}
			.bot-Content{
				padding:  20rpx;
				display: flex;
				flex-direction: column;
				.content{
					color: #808080;
				}
				.type{
					align-self: flex-end;
					background-color: #ffedde;
					border-radius: 25rpx;
					width: 100rpx;
					height: 40rpx;
					display: grid;
					place-items: center;
					margin-right: 10rpx;
				}
			}
		}
	}
  }
</style>
